Skip to content

Using encrypted databases

SQLite Expert Professional can open and manage encrypted databases, provided you supply a SQLite library that includes encryption support. For legal reasons, such a library is not bundled with SQLite Expert, so you need to add one yourself.

Choosing a SQLite library

Open Tools → Options → SQLite Library to see the list of SQLite library DLLs found in the installation directory. To use a library other than the default, copy its DLL into the installation directory and select it here.

The folder is read when SQLite Expert starts, so a library copied in while the program is running is not listed yet. Press Refresh, below the list, to look again — there is no need to restart.

The library must match the edition of SQLite Expert: a 64-bit DLL for the 64-bit edition, a 32-bit DLL for the 32-bit one. Several libraries with encryption support are available, as open-source or commercial products:

  • SQLite3 Multiple Ciphers — open source (MIT), with ready-made Windows DLLs: sqlite3mc_x64.dll in the win64 download, sqlite3mc.dll in the win32 one. Its default cipher is ChaCha20, which is also the default of the SQLite3MC.PCLRaw.bundle package for .NET.
  • SQLCipher — open source, distributed as source code; ready-made Windows DLLs are part of Zetetic's commercial editions. Databases created with the SQLCipher 4 defaults open; databases created with SQLCipher 3 or earlier, or with custom cipher settings, do not.
  • System.Data.SQLite — public domain. Only versions up to 1.0.112 include encryption in their SQLite.Interop.dll, which is compatible with the sqlite3crypt.dll used by older versions of SQLite Expert.
  • The SQLite Encryption Extension (SEE) — commercial, distributed as source code to licensees, who build their own DLL. It works with databases encrypted through sqlite3_key or PRAGMA key, the usual way applications use SEE. There are two exceptions. Databases encrypted with SEE's textkey or hexkey options do not open, because SQLite Expert passes the key exactly as you type it. And a build that must be activated with sqlite3_activate_see before it decrypts does not work at all, because SQLite Expert does not activate it.
  • The Free SQLite Encryption Extension (FSEE) — open source, no longer maintained. Its only DLL is 32-bit and based on SQLite 3.7.10, which is too old for current versions of SQLite Expert to load.

Note

SQLite Expert opens a database using the library's default cipher settings. Some libraries can encrypt in more than one way: SQLite3 Multiple Ciphers offers several ciphers, and SQLCipher has settings that differ between its versions. A database that was encrypted with anything other than the defaults does not open, even with the right key, and the error is the same as for a wrong key. Choosing the cipher and its settings is not yet supported.

The library list in Options shows ENC or ENC2 next to a library that supports encryption.

Working with encryption keys

When a library that supports encryption is active, the following commands appear on the database tree pop-up menu:

  • Set an encryption key on a database that was previously unencrypted — this encrypts the database with the key you provide.
  • Enter the encryption key to open an existing encrypted database. This only unlocks the database for the session; it does not change its contents.
  • Change the encryption key — re-encrypts the database with a new key. To remove encryption entirely, enter an empty key. SQLite Expert asks Remove encryption key? before it does, defaulting to No: an empty key leaves the file readable by anyone who has it, which is worth a moment's thought when it was not what you meant to type.
  • Enter a default encryption key — a key that SQLite Expert tries first for every encrypted database. Clearing this one is confirmed too, with Clear the default encryption key?

The question is only asked where a key is actually being taken away. Leaving the box empty on a database that was never encrypted changes nothing, and entering nothing at the prompt that asks for the key to open a database is the ordinary answer when it turns out not to need one — neither is queried.

Remembering keys between sessions

If you would like SQLite Expert to remember your encryption keys (including the default key) between sessions, enable Remember encryption keys under Tools → Options → General → Startup. The keys are then stored, encrypted, with the program settings.

Warning

Remembering keys is more convenient but less secure, because the keys are stored on disk. For this reason the option is disabled by default. Leave it off on shared or untrusted computers.

See also: Performing an online backup of a database · Changing options